package com.xuhuan.demo.pattern.adapter.classadapter;

/**
 * @author huan.xu
 * @date 2021/10/5 23:06
 * @description 电压适配器
 */
public class VoltageAdapter extends Voltage220V implements IVoltageAdapter {

    /**
     * 电压适配为5V
     *
     * @return
     */
    @Override
    public int output5V() {
        int srcV = super.output220V();
        int targetV = srcV / 44;
        System.out.println("电压被适配为" + targetV + "V");
        return targetV;
    }

    /**
     * 电压适配为66V
     *
     * @return
     */
    @Override
    public int output110V() {
        int srcV = super.output220V();
        int targetV = srcV / 2;
        System.out.println("电压被适配为" + targetV + "V");
        return targetV;
    }
}
